<?php

class News_Page_Main_Exception extends Page_Main_Exception {}
class News_Page_Main_Invalid_Exception extends News_Page_Main_Exception {}

abstract class News_Page_Main extends Page_Main {

	protected function URL($array = array()){
		return parent::URL(array_merge(
			array('news'),
			$array
		));
	}

	public function rid($array = array()){
		return array_merge(
			array('content'),
			$array
		);
	}

	public static function Load($args){
		if($args['parent']->data_top() == 'article'){
			$args['parent']->data_shift();
			CMS::File('news/page_main/article');
			return News_Page_Main_Article::Load($args);
		}
		if($args['parent']->data_top() == 'category'){
			$args['parent']->data_shift();
			CMS::File('news/page_main/category');
			return News_Page_Main_Category::Load($args);
		}
		throw new News_Page_Main_Invalid_Exception($args);

	}

}
